package cn.iocoder.yudao.module.biz.dal.mysql.resFile;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.resFile.ResFileDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.resFile.vo.*;

/**
 * 资源库文件 Mapper
 *
 * @author wangfy
 */
@Mapper
public interface ResFileMapper extends BaseMapperX<ResFileDO> {

    default PageResult<ResFileDO> selectPage(ResFilePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResFileDO>()
                .likeIfPresent(ResFileDO::getResName, reqVO.getResName())
                .eqIfPresent(ResFileDO::getResType, reqVO.getResType())
                .eqIfPresent(ResFileDO::getDeleted, 0)
                .orderByDesc(ResFileDO::getId));
    }

    default List<ResFileDO> selectList(ResFileExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ResFileDO>()
                .likeIfPresent(ResFileDO::getResName, reqVO.getResName())
                .eqIfPresent(ResFileDO::getResType, reqVO.getResType())
                .eqIfPresent(ResFileDO::getDeleted, 0)
                .orderByDesc(ResFileDO::getId));
    }

}
